<template>
    <ul class="videoALL">
          <li class="videoList" v-for="(h, index) in hun.content" :key="h.id">
            <div class="video">
              <img class="videoInfo" :src="h.cover" />
              <div class="videoMessage">
                <!-- 之后需要绑定点击事件跳转到视频页 -->
                <div>{{h.title}}</div>
                <span class="housework">视频课</span>
              </div>
            </div>
            <div class="time">{{calcTime(h.createTime)}}</div>
          </li>
        </ul>
   
        <div class="noContain" v-if="!hun.content.length" >
          <span>无更多数据</span>
        </div>
</template>
<script lang="ts">
export default{
    name:'huancun',
}
</script>
<script  lang="ts" setup>
import {onMounted} from 'vue';
import useUserInfoStore from '../../../store/practive/index'

const hun = useUserInfoStore();

//计算时间
const calcTime = (time) => {
  if ((new Date().getTime() - time)> 6000000) {
    let hour = Math.floor((new Date().getTime() - time) / 1000 / 60 / 60);
    return hour + "小时";
  }

  let minutes = Math.floor((new Date().getTime() - time) / 1000 / 60);
  return minutes + "分钟";
  // moment(time).startOf('hour').fromNow();
};
onMounted(()=>{
  hun.getHuanCun();
})
</script>

<style scoped>
.videoALL {
  margin: 0 auto;
}
.videoList {
  width: 963px;
  height: 121px;
  margin: 10px 0;
  display: flex;
  margin: 0 auto;
}
.videoList:hover {
  background-color: #f5f7fa;
}
.video {
  width: 680px;
  height: 121px;
  display: flex;
}
.video .videoInfo {
  width: 169px;
  height: 101px;
  margin: 10px 10px;
  border-radius: 5px;
}
.video .videoMessage {
  margin: 10px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.video .videoMessage .housework {
  color: rgb(125, 128, 144);
  font-size: 12px;
}
.video .videoMessage img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  vertical-align: text-top;
  margin-right: 10px;
}
.time {
  width: 153px;
  height: 121px;
  line-height: 121px;
  text-align: center;
  font-size: 14px;
  margin-left: 100px;
}
.deleteOne {
  width: 145px;
  height: 121px;
  line-height: 121px;
  text-align: right;
  font-size: 14px;
  color: #b1b3bc;
  margin-right: 5px;
}
.deleteOne:hover {
  color: #f93684;
  cursor: pointer;
}

.noContain {
  text-align: center;
  height: 80px;
  line-height: 80px;
  border-bottom: solid 1px #606266;
  color: #606266;
}

</style>